package com.binfast.seed.config;

import cn.hutool.log.Log;
import cn.hutool.log.LogFactory;
import com.binfast.seed.amiExt.*;
import org.beetl.sql.core.SQLManager;
import org.beetl.sql.core.mapper.builder.MapperConfigBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

@Component
@Order(2)
public class RunningConfig implements CommandLineRunner {

    private static final Log log = LogFactory.get();

    @Autowired
    SQLManager sqlManager;

    @Override
    public void run(String... args) throws Exception {
        MapperConfigBuilder builder = this.sqlManager.setBaseMapper(BaseDao.class).getBuilder();
        builder.addAmi("updateBatch",new UpdateBatchAmiExt());//可用
        builder.addAmi("findByIdAndDeleted",new FindByIdAndDeletedAmiExt());//可用
        builder.addAmi("saveOne",new SaveAmiExt());//可用
        builder.addAmi("deleteBatch",new DeleteBatchAmiExt());//可用
        builder.addAmi("saveAll",new SaveAllAmiExt());//可用
    }
}
